import http from "@/utils/http";

// 获取多轮列表
export async function getDialogs(body) {
	return http.post("/dialog/getDialogs", body);
}

// 设置多轮会话状态
export async function setDialogStatus(body) {
	return http.post("/dialog/setDialogStatus", body);
}

// 删除多轮会话
export async function deleteDialog(body) {
	return http.post("/dialog/deleteDialog", body);
}

// 添加多轮对话
export async function addDialog(body) {
	return http.post("/dialog/addDialog", body);
}

// 获取全局设置
export async function getSetting(body) {
	return http.get("/dialog/setting", body);
}

// 保存全局设置
export async function doSetting(body) {
	console.log("body :" + JSON.stringify(body));
	return http.post("/dialog/setting", body);
}

// 根据多轮id获取对应的词槽
export async function getDialogSlots(body) {
	return http.postFormData("/dialog/getDialogSlots", body);
}

// 根据多轮id获取对应的图数据
export async function getDialogTemplate(body) {
	return http.postFormData("/dialog/getDialogTemplate", body);
}

// 根据多轮id，节点id，get stage

export async function getStageBydialogIdAndNodeId(body) {
	return http.get("/dialog/stage", body);
}

//2.0 动作节点编辑接口
export async function getActionNodeDetail(body) {
	return http.get("/dialog/flowAction/stage", body);
}

// 添加或编辑全局设置-特殊情况处理
export async function specialQaDoAdd(body) {
	return http.post("/dialog/saveGlobalQa", body);
}

// 删除全局设置-特殊情况处理
export async function doSaveQaList(body) {
	return http.post("/dialog/setting", body);
}

// 根据多轮id，节点id，save stage

export async function saveStageBydialogIdAndNodeId(body) {
	return http.post("/dialog/stage", body);
}

// 根据多轮id add slot

export async function updateSlotByAddSlot(body) {
	return http.post("/dialog/updateSlot", body);
}

// 根据多轮id slotID查询slot是否被使用

export async function querySlotIsUsedByDialog(body) {
	return http.post("/dialog/slotIsUsedByDialog", body);
}

// 根据多轮id save dialog

export async function saveDialogTemplate(body) {
	return http.post("/dialog/template", body);
}

// 复制节点
export async function copyDialogNode(body) {
	return http.get("/dialog/copyNode", body);
}

// 保存多轮会话数据
export async function saveStage(body) {
	return http.post("/dialog/stage", body);
}
// 分词接口
export async function splitWord(body) {
	return http.post("/common/splitWord", body);
}

// 获取多轮词槽列表
export async function getCommonDialogSlots(body) {
	// return http.post('/dialog/stage/slot/getDialogSlots',body)
	return http.postFormData("/dialog/getDialogSlots", body);
}

// 获取多轮inquire
export async function getDialogInquire(body) {
	return http.post("/dialog/stage/slot/inquire", body);
}

// 获取多轮用户所有词典
export async function getUserAllDict(body) {
	return http.post("/dialog/getAllDict", body);
}

// 获取多轮配置的API
export async function getAllApi(body) {
	return http.post("/dialog/getApiInfoFromSetting", body);
}

// 获取API列表
export async function loadActionApis(body) {
	console.log("api列表");
	return http.post("/api/actionApi/loadActionApis", body);
}

// 获取API列表
export async function loadActionApi(body) {
	return http.post("/api/actionApi/loadActionApi", body);
}

// 训练多轮对话
export async function startTraining(body) {
	return http.postFormData("/dialog/startTraining", body);
}

// 发布多轮
export async function publish(body) {
	return http.postFormData("/dialog/publish", body);
}

// 根据词擦id查询核心词
export async function getCoreWordById(body) {
	return http.get("/base/model/getModelBySlotId", body);
}

// 根据多轮id查询训练结果
export async function getTrainResult(body) {
	return http.get("/dialog/getTrainResult", body);
}

// 根据多轮id查询当前状态
export async function getStatusById(body) {
	return http.get("/dialog/getStatusById", body);
}

// 根据多轮ID查询训练进度
export async function getProgress(body) {
	return http.get("/dialog/getProgress", body);
}

// 根据多轮id修改多轮name
export async function updateDialogName(body) {
	return http.post("/dialog/updateDialogName", body);
}

// 下载语料标注模板
export async function markTemplate(body) {
	return http.downloadFile("/dialog/mark/template", body);
}

//2.0版本
export async function fetchDialogCategory(body) {
	return http.get("/dialog/category/info", body);
}

export async function doEditDialogCategory(body) {
	return http.post("/dialog/category/edit", body);
}

export async function cancelDialogTraining(body) {
	return http.postFormData("/dialog/stopTraining", body);
}

//2.0
export async function doDeleteSpecialQaList(body) {
	return http.postFormData("/dialog/stage/delete/special", body);
}

/** 多轮-信息确认节点-导出语料模板 */
export async function getDownloadCorpus(body) {
	return http.downloadFile("/dialog/download", body);
}

/** 多轮-信息确认节点-导入语料 */
export async function postImportCorpus(body) {
	return http.uploadFile("/dialog/importCorpus", body);
}

//多轮-复制
export async function doCopyDialog(body) {
	return http.post("/dialog/copy", body);
}

// 导出多轮对话
export async function downloadDialog(body) {
	return http.downloadFile('/dialog/downloadDialog', body);
}

// 导入多轮对话
export async function uploadDialog(body) {
	return http.uploadFile('/dialog/importDialog', body);
}

// 移动分类
export async function doMoveDialog(body) {
	return http.postFormData("/dialog/move", body);
}

// 多轮基本信息
export async function FetchDialogInfo(body) {
	return http.get("/dialog/simple/info", body);
}


// 模板市场-->系统知识库-->多轮列表
export async function knowledgeListDialog(body) {
	return http.get("/knowledge/systemTemplate/listDialog", body);
}
// 模板市场-->系统知识库-->多轮跟节点信息
export async function knowledgeDialogInfo(body) {
	return http.get("/knowledge/systemTemplate/getDialogInfo", body);
}
// 模板市场-->系统知识库-->多轮模板信息
export async function knowledgeDialogTemplate(body) {
	return http.get("/knowledge/systemTemplate/getDialogTemplate", body);
}
// 模板市场-->系统知识库-->多轮词槽
export async function knowledgeDialogSlots(body) {
	return http.get("/knowledge/systemTemplate/getDialogSlots", body);
}
// 模板市场-->系统知识库-->多轮分类信息
export async function knowledgeDialogCategoryInfo(body) {
	return http.get("/knowledge/systemTemplate/getDialogCategoryInfo", body);
}
// 模板市场-->系统知识库-->多轮节点信息
export async function knowledgeDialogNodeInfo(body) {
	return http.get("/knowledge/systemTemplate/getDialogNodeInfo", body);
}
// 模板市场-->系统知识库-->多轮节点信息
export async function knowledgeDialogActionNodeInfo(body) {
	return http.get("/knowledge/systemTemplate/getDialogActionNodeInfo", body);
}
// 模板市场-->系统知识库-->多轮获取所有词槽
export async function knowledgeDialogInquire(body) {
	return http.get("/knowledge/systemTemplate/inquire", body);
}
// 模板市场-->系统知识库-->多轮获取所有关联话术
export async function knowledgeDialogAllDict(body) {
	return http.post("/knowledge/systemTemplate/getAllDict", body);
}
// 模板市场-->系统知识库-->多轮获取api配置
export async function knowledgeDialogApiInfoFromSetting(body) {
	return http.post("/knowledge/systemTemplate/getApiInfoFromSetting", body);
}
